package cn.tedu.tourism.order.service.impl;

import cn.tedu.tourism.order.mapper.OrderMapper;
import cn.tedu.tourism.order.pojo.dto.RoomOrdersParam;
import cn.tedu.tourism.order.pojo.entity.RoomOrders;
import cn.tedu.tourism.order.service.OrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

@Slf4j
@Service
public class OrderServiceImpl implements OrderService {
    @Autowired
    private OrderMapper orderMapper;

    @Override
    public void roomOrder(RoomOrdersParam roomOrdersParam) {
        log.debug("添加订单信息业务：{}",roomOrdersParam);
        RoomOrders roomOrders = new RoomOrders();
        BeanUtils.copyProperties(roomOrdersParam,roomOrders);
        roomOrders.setCreateTime(new Date());
        roomOrders.setStatus("1");
        orderMapper.insert(roomOrders);
    }
}
